# armclang settings

if(NOT DEFINED ENV{ARMCLANG_PATH})
    message(FATAL_ERROR  "env \"ARMCLANG_PATH\" not set")
endif()

set(ARMCLANG_PATH $ENV{ARMCLANG_PATH})

set(CMAKE_C_COMPILER    ${ARMCLANG_PATH}/armclang.exe)
set(CMAKE_CXX_COMPILER  ${ARMCLANG_PATH}/armclang.exe)
set(CMAKE_CSM_COMPILER  ${ARMCLANG_PATH}/armclang.exe)

set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_ASM_COMPILER_WORKS TRUE)

set(CMAKE_C_LINK_EXECUTABLE ${ARMCLANG_PATH}/armlink.exe)
set(CMAKE_CXX_LINK_EXECUTABLE ${ARMCLANG_PATH}/armlink.exe)
set(CMAKE_ASM_LINK_EXECUTABLE ${ARMCLANG_PATH}/armlink.exe)
set(FROMELF_EXECUTABLE ${ARMCLANG_PATH}/fromelf.exe)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set_property(GLOBAL PROPERTY SUFFIX ".axf")

if(NOT EXISTS ${CMAKE_C_COMPILER})
    message(FATAL_ERROR  "Compiler ${CMAKE_C_COMPILER} is not exists")
endif()
